package com.imti.mall.sale.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.PageHelper;
import com.imti.mall.model.sms.pojo.SmsHomeNewProduct;
import com.imti.mall.model.sms.vo.SmsHomeNewProductPicVo;
import com.imti.mall.sale.dao.SmsHomeNewProductDao;
import com.imti.mall.sale.service.SmsHomeNewProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SmsHomeNewProductServiceImpl extends ServiceImpl<SmsHomeNewProductDao, SmsHomeNewProduct> implements SmsHomeNewProductService {

    @Autowired
    SmsHomeNewProductDao smsHomeNewProductDao;
    /**
     * 查询新品推荐商品
     */
    @Override
    public List<SmsHomeNewProduct> findSmsHomeNewProduct(SmsHomeNewProduct smsHomeNewProduct,Integer pageSize, Integer pageNum) {
        PageHelper.startPage(pageNum, pageSize);
        return smsHomeNewProductDao.findSmsHomeNewProduct(smsHomeNewProduct);
    }
    /**
     * 修改新品推荐商品
     * @param smsHomeNewProduct
     * @return
     */
    @Override
    public Integer updateSmsHomeNewProduct(SmsHomeNewProduct smsHomeNewProduct) {
        return smsHomeNewProductDao.updateSmsHomeNewProduct(smsHomeNewProduct);
    }
    /**
     * 根据id删除新品推荐商品
     * @param id
     * @return
     */
    @Override
    public Integer delSmsHomeNewProduct(Integer id) {
        return smsHomeNewProductDao.deleteById(id);
    }
    /**
     * 添加新品推荐商品
     * @param smsHomeNewProduct
     * @return
     */
    @Override
    public Integer addSmsHomeNewProduct(SmsHomeNewProduct smsHomeNewProduct) {
        return smsHomeNewProductDao.insert(smsHomeNewProduct);
    }

    /**
     * 查询图片信息
     * @param smsHomeNewProductPicVo
     * @return
     */
    @Override
    public List<SmsHomeNewProductPicVo> findSmsHomeNewProductPic(SmsHomeNewProductPicVo smsHomeNewProductPicVo) {
        return smsHomeNewProductDao.findSmsHomeNewProductPic(smsHomeNewProductPicVo);
    }
}
